package com.example.boss.db.gen;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

/**
 * Created by 打好boss on 2018/6/12.
 */

public class greenDaoManager {
    private static DaoSession daoSession;

    /**
     *  配置数据库
     */
    public static void InitDao(Context context, String dbName){
        //创建数据库
        DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(context,dbName,null);
        //获取可写数据库
        SQLiteDatabase db = helper.getWritableDatabase();
        //获取数据库对象
        DaoMaster daoMaster = new DaoMaster(db);
        //获取Dao对象管理者
        daoSession = daoMaster.newSession();
    }

    public static DaoSession getDaoSession(){
        return daoSession;
    }
}
